using UnityEngine;

[ExecuteInEditMode]
public class PresetsPlatformMobile : MonoBehaviour
{
	[HideInInspector]
	public ControllerPlatformMobileTarget controllerStart;

	[HideInInspector]
	public ControllerPlatformMobileTarget controllerFinish;

	public float startDelay;

	public float speed = 1f;

	public float pause;

	private ControllerPlatformMobile controller;

	private void LateUpdate()
	{
		if (Application.isEditor && !Application.isPlaying)
		{
			Refresh();
		}
	}

	private void Refresh()
	{
		if (controller == null)
		{
			controller = base.gameObject.GetComponent<RemoteControl>().controller.GetComponent<ControllerPlatformMobile>();
			speed = controller.speed;
			startDelay = controller.startDelay;
			pause = controller.pause;
		}
		if (controller != null)
		{
			controller.speed = speed;
			controller.startDelay = startDelay;
			controller.pause = pause;
		}
		if (controller.start == null && controllerStart != null)
		{
			controller.start = controllerStart.gameObject;
		}
		if (controller.finish == null && controllerFinish != null)
		{
			controller.finish = controllerFinish.gameObject;
		}
	}

	public void SetupControllerStart(Object prefab)
	{
	}

	public void SetupControllerFinish(Object prefab)
	{
	}

	public void SetPositionControllerStart(Vector3 pos)
	{
		if (controllerStart != null)
		{
			controllerStart.remoteControl.SetPosition(pos);
		}
	}

	public void SetPositionControllerFinish(Vector3 pos)
	{
		if (controllerFinish != null)
		{
			controllerFinish.remoteControl.SetPosition(pos);
		}
	}
}
